import java.util.Scanner;

public class demo8 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入要找的数:");
        int num= scanner.nextInt();
        int[]arr={19,28,37,46,50};
        int index=-2;
        int S=a(arr,num,index);
        System.out.println("您要找的索引为:"+S);
    }
    public static int a(int[]arr,int num,int index){
        for (int i = 0; i <arr.length ; i++) {
            if (arr[i]==num) {
                index=i;
                break;
            }
        }
        return index;
    }
}
